package com.klangner.go.app.strategy;

import com.klangner.game.board.Move;
import com.klangner.go.app.rules.BoardModel;

// The purpose of this class is to wrap all the information that should
// be associated with a node in a Go game tree
public class GoNodeInfo {

    public GoNodeInfo(float estimatedValue,
                          //Move lastMove,
                      BoardModel position) {
        this.estimatedValue = estimatedValue;
//    this.lastMove = lastMove;
        this.nextMove = null;
        this.position = position;
    }

    public int turn() {
        return position.getTurnColor();
    }

    public String toString() {
        String result = "";
        String nextMoveStr = "";
        
        if (nextMove != null) {
            nextMoveStr = nextMove.getX() + ", " + nextMove.getY();
        }
        else {
            nextMoveStr = "NULL";
        }
        
        result = result + "[" + turn() + "; " + estimatedValue +
            "; (" + nextMoveStr + ")]";

        return result;
    }
    
        // I made these members public for performance reasons, because they are
        // accessed very often during game tree analysis
    public float estimatedValue;
//  private Move lastMove;
    public Move nextMove;  
    public BoardModel position;
}
